<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <title>资讯管理</title>
    <#include "/header.html">
</head>
<body>
<div id="classifieds" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
            <div class="form-group col-sm-2">
                <input type="text" class="form-control" v-model="q.newsTitle" @keyup.enter="query" placeholder="资讯标题">
            </div>
            <a class="btn btn-default" @click="query">查询</a>
            <#if shiro.hasPermission("sys:user:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            </#if>
            <#if shiro.hasPermission("sys:user:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            </#if>
            <#if shiro.hasPermission("sys:user:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
            </#if>
            <#if shiro.hasPermission("sys:user:delete")>
                <a class="btn btn-primary" @click="publish"><i class="fa fa-info"></i>&nbsp;发布</a>
            </#if>
        </div>
        <!--vip申请列表-->
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">资讯类型</div>
                <label class="radio-inline">
                    <input type="radio" value="article" v-model="news.typeCode" @click="isShow(false)"/> 文章
                </label>
                <label class="radio-inline">
                    <input type="radio" value="video" v-model="news.typeCode" @click="isShow(true)" /> 视频
                </label>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">资讯分类</div>
                <div class="col-sm-10">
                    <select v-model="news.classifiedId" id = "classifiedId" class="form-control">
                        <option v-for="item in list"  v-bind:value="item.id">{{ item.classifiedsName }}</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">标题</div>
                <div class="col-sm-10">
                    <input type="text" id = "title" class="form-control" v-model="news.newsTitle" autofocus="autofocus"/>
                </div>
            </div>
            <div class="form-group" v-show="coverImg">
                <div class="col-sm-2 control-label">封面图片</div>
                <div class="col-sm-10">
                    <button type="button" class="layui-btn" id="uploadCover"><i class="layui-icon layui-icon-upload-drag"></i>上传图片</button><br/>
                    <img v-show="showCoverImg"  v-bind:src=news.newsCover id="showImg" style="width: 150px;height:150px;margin:10px 0 0 0;">
                </div>
            </div>
            <div class="form-group" v-show="videoUpload">
                <div class="col-sm-2 control-label">上传视频</div>
                <div class="col-sm-10">
                    <button type="button" class="layui-btn" id="uploadVideo"><i class="layui-icon layui-icon-video"></i>上传视频</button>
                    <div>
                        <!--src="http://video.qiniu.vp359.com/aacafd7e3f7b4236bd1e5db16cacb3e0.mp4"-->
                        <video  v-show="showVideo" v-bind:src=news.videoUrl controls="controls" style="width: 200px;height: 200px;margin:10px 0 0 0;"></video>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">简介</div>
                <div class="col-sm-10">
                    <textarea id = "profile" placeholder="简单介绍下这个资讯吧..." v-model="news.profile" style="width: 370px;height: 80px;"></textarea>
                </div>
            </div>
            <div class="form-group" v-show="editor">
                <div class="col-sm-2 control-label">文章内容</div>
                <div class="col-sm-10">
                    <div id="editor1" style="width: 700px;" v-model="news.newsContent"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>

    </div>
</div>
<script src="/news/script/manage.js?_${.now?long}"></script>
</body>
</html>